package com.tencent.sr.iris.basic.saas.service.model;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.tencent.sr.iris.activity.interfaces.response.group.GroupNormalTaskSecondResponse;
import com.tencent.sr.iris.basic.saas.common.enums.IrisPromoteStatusEnum;
import com.tencent.sr.iris.basic.saas.common.utils.CommonUtils;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Data
@ApiModel(value = "团长视角二级页面-(普通团推团)导出信息")
@Slf4j
@ColumnWidth(15)
public class GroupBoardNormalExportInfo {
    @ExcelProperty(value = "序号", index = 0)
    private int num;

    //贡献状态 1.贡献中,2.已结束
    @ExcelProperty(value = "贡献状态", index = 1)
    private String promoteStatus;

    @ExcelProperty(value = "被邀请时间", index = 2)
    private String promoteUserInviteDatetime;

    @ExcelProperty(value = "uid", index = 3)
    private String irisUid;

    @ExcelProperty(value = "union ID", index = 4)
    private String wechatUserUnionid;

    @ExcelProperty(value = "昵称", index = 5)
    private String wechatUserNickname;

    // promoteStart至promoteEnd
    @ExcelProperty(value = "当月业绩统计时间", index = 6)
    private String settlementTime;

    @ExcelProperty(value = "当月贡献销售额", index = 7)
    private Double sumMonthValidGmv;

    @ExcelProperty(value = "当月贡献收益", index = 8)
    private Double sumMonthValidCommissionBillCommissionFee;

    @ExcelProperty(value = "累计贡献收益", index = 9)
    private Double sumValidCommissionBillCommissionFee;

    @ExcelProperty(value = "累计贡献销售额", index = 10)
    private Double sumPromoteGmv;

    public void readFromSearchResponseData(GroupNormalTaskSecondResponse response) {
        this.setPromoteStatus(IrisPromoteStatusEnum.getByStatus(response.getPromoteStatus()));
        this.setPromoteUserInviteDatetime(response.getPromoteUserInviteDatetime());
        this.setIrisUid(response.getIrisUid());
        this.setWechatUserUnionid(response.getWechatUserUnionid());
        this.setWechatUserNickname(response.getWechatUserNickname());
        this.setSettlementTime(response.getPromoteStart() + "至" + response.getPromoteEnd());
        this.setSumMonthValidGmv(CommonUtils.integerToDouble(response.getSumMonthValidGmv()));
        //this.setPredictCommissionFee(response.getPredictCommissionFee());
        this.setSumPromoteGmv(CommonUtils.integerToDouble(response.getSumPromoteGmv()));
        //this.setSumPredictCommissionFee(response.getSumPredictCommissionFee());

        this.setSumMonthValidCommissionBillCommissionFee(CommonUtils.longToDouble(response.getSumMonthValidCommissionBillCommissionFee()));
        this.setSumValidCommissionBillCommissionFee(CommonUtils.longToDouble(response.getSumValidCommissionBillCommissionFee()));
    }
}
